/*
 * Toolset.cpp
 *
 *  Created on: Mar 24, 2011
 *      Author: hxu
 *      Universal tools
 */

#include"Toolset.h"
#include<cmath>
#include<cstdlib>
#include<vector>
#include<map>

using namespace std;

namespace Txuh{

int str2int(const std::string & str1){
	int n1;
	n1 = std::atoi(str1.c_str());
	return n1;
}

double str2double(const std::string & str1){
	double n1;
	n1 = std::atof(str1.c_str());
	return n1;
}

int round(const double& num){
	return int(floor(num+0.5));
}

int get_manh_dist(const int x1, const int y1, const int x2, const int y2){
	// get manhattan distance
	int d = abs(x1-x2)+abs(y1-y2);
	return d;
}

}
